# Maintainer: Laurent Carlier <lordheavym@gmail.com>
# Contributor: Lukas Jirkovsky <l.jirkovsky@gmail.com>

pkgname=ocl-icd
pkgver=2.3.1
pkgrel=1
pkgdesc="OpenCL ICD Bindings"
arch=('x86_64')
url="https://github.com/OCL-dev/ocl-icd"
license=('BSD')
depends=('glibc')
makedepends=('ruby' 'mesa' 'xmlto' 'asciidoc' 'opencl-headers>=2.1')
checkdepends=()
provides=('opencl-icd-loader')
conflicts=('libcl')
replaces=('libcl')
optdepends=('opencl-driver: packaged opencl driver')
source=("ocl-icd-${pkgver}.tar.gz::https://github.com/OCL-dev/${pkgname}/archive/v${pkgver}.tar.gz")
sha256sums=('a32b67c2d52ffbaf490be9fc18b46428ab807ab11eff7664d7ff75e06cfafd6d')

prepare() {
  cd "$srcdir/$pkgname-$pkgver"
  autoreconf -fiv
}

build() {
  cd "$srcdir/$pkgname-$pkgver"
  CFLAGS+=' -fcommon' # https://wiki.gentoo.org/wiki/Gcc_10_porting_notes/fno_common
  ./configure --prefix=/usr
  make
}

check() {
  cd "$srcdir/$pkgname-$pkgver"
  make -k check
}

package() {
  cd "$srcdir/$pkgname-$pkgver"
  make DESTDIR="$pkgdir/" install

  install -m755 -d "$pkgdir/usr/share/licenses/ocl-icd"
  install -m644 "$srcdir/$pkgname-$pkgver/COPYING" "${pkgdir}/usr/share/licenses/ocl-icd/"
}

# vim:set ts=2 sw=2 et:
